//
//  LocalPlayerClass.m
//  Mecca
//
//  Created by TH-MAC02 on 7/30/14.
//  Copyright (c) 2014 TapDash Heuristics. All rights reserved.
//

#import "LocalPlayerClass.h"

static LocalPlayerClass *sharedItem = nil;

@implementation LocalPlayerClass

- (void) playAudioFromData: (NSData*) data {
    NSError *error = nil;
    
    //    player=[[AVAudioPlayer alloc]initWithContentsOfURL:url error:NULL];
    //    player.delegate=self;
    //    [player play];
    self.audioPlayer = [[AVAudioPlayer alloc] initWithData:data error:&error];
    self.audioPlayer.delegate = self;
    [self.audioPlayer prepareToPlay];
    [self.audioPlayer play];
    
}

- (void)stopAudio{

    [self.audioPlayer stop];
}



#pragma mark - SingleTon

+ (LocalPlayerClass *)sharedItems
{
    if (sharedItem == nil) {
        sharedItem = [[super allocWithZone:NULL]init];
    }
    return  sharedItem;
}
- (id)init{
    if ((self = [super init])) {
        
    }
    return self;
}
+ (id)allocWithZone:(NSZone *)zone{
    return  [self sharedItems];
}
- (id)copyWithZone:(NSZone *)zone{
    return self;
}

@end
